package cn.itcast.crm.service;

import java.util.List;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;

import cn.itcast.crm.domain.Customer;

public interface CustomerService {
	
	//查询所有未关联客户
	@Path("/noassociationcustomers")
	@GET
	@Produces({"application/xml","application/json"})
	public List<Customer> findNoAssociationCustomers();
	
	//已经关联到指定定区的客户列表
	@Path("/associationfixedareacustomers/{fixedareaid}")
	@GET
	@Produces({"application/xml","application/json"})
	@Consumes({"application/xml","application/json"})
	public List<Customer> findHasAssociationFixedAreaCustomers(@PathParam("fixedareaid")String fixedAreaId);
	
	//将客户关联到定区上,
	@Path("/associationcustomerstofixedarea")
	@PUT
	@Consumes({"application/xml","application/json"})
	public void  associationCustomersToFixedArea(@QueryParam("customerIdStr") String customerIdStr,@QueryParam("fixedAreaId") String fixedAreaId);
	
	//服务端,用户注册功能
	@Path("/customer")
	@POST
	@Consumes({ "application/xml", "application/json" })
	public void regist(Customer customer);

	//使用电话号码查询唯一的客户对象
	@Path("/customer/telephone/{telephone}")
	@GET
	@Consumes({ "application/xml", "application/json" })
	@Produces({ "application/xml", "application/json" })
	public Customer findByTelephone(@PathParam("telephone") String telephone);
	
	//使用电话号码作为条件,更新type'值
	@Path("/customer/updatetype/{telephone}")
	@PUT
	@Consumes({ "application/xml", "application/json" })
	public void updateType(@PathParam("telephone") String telephone);
	
	//使用手机账号和密码登录
	@Path("/customer/findByTelephoneAndPassword")
	@GET
	@Consumes({ "application/xml", "application/json" })
	@Produces({ "application/xml", "application/json" })
	public Customer findByTelephoneAndPassword(@QueryParam("telephone") String telephone
			,@QueryParam("password") String password);
	
	//根据客户id和地址查询是否是客户的邮递地址
		@Path("/customer/findFixedByCustomer_idAndAddress")
		@GET
		@Consumes({ "application/xml", "application/json" })
		@Produces({ "application/xml", "application/json" })
		public String findFixedByCustomer_idAndAddress(@QueryParam("address") String address
				,@QueryParam("customer_id") Integer customer_id);
	
	
}
